package sh.grapendaal.tsuushin.module.uno.engine;

/**
 * This class represents a card in the game.
 */
public class Card {
	public enum Color {
		BLUE, GREEN, RED, YELLOW, WILDCARD
	}

	public enum Rank {
		NONE, ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, DRAW_TWO, DRAW_FOUR, REVERSE, SKIP
	}

	private Color color;

	private Rank rank;

	/**
	 * Constructs a new card with the given properties.
	 * 
	 * @param color
	 *            The color of the card.
	 * @param rank
	 *            The rank of the card.
	 */
	public Card(Color color, Rank rank) {
		this.color = color;
		this.rank = rank;
	}

	public Color getColor() {
		return color;
	}

	public Rank getRank() {
		return rank;
	}

	@Override
	public String toString() {
		return "Card [color=" + color + ", rank=" + rank + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((color == null) ? 0 : color.hashCode());
		result = prime * result + ((rank == null) ? 0 : rank.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Card other = (Card) obj;
		if (color != other.color) {
			return false;
		}
		if (rank != other.rank) {
			return false;
		}
		return true;
	}
}
